-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Chore: Fix pylint issues with new version of pylint #150
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Annotations of changes
StatusNodeUnavailable: returned when the node isn't in the cluster | ||
StatusNodeInUse: returned when the node is in the cluster already | ||
STATUS_NODE_UNAVAILABLE: returned when the node isn't in the cluster | ||
STATUS_NODE_IN_USE: returned when the node is in the cluster already | ||
""" | ||
|
||
StatusNodeUnavailable = 520 | ||
StatusNodeInUse = 521 | ||
STATUS_NODE_UNAVAILABLE = 520 | ||
STATUS_NODE_IN_USE = 521 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pylint wanted const values to be CAPITALIZED
class UserFacingDatastoreConfig(BaseModel, allow_population_by_field_name=True): # type: ignore[call-arg] | ||
class UserFacingDatastoreConfig(BaseModel, allow_population_by_field_name=True): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This wasn't in error any longer?
🤷🏻
ops==2.16.0 | ||
ops==2.16.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better typing in ops
logging.info(f"Downloading {source_url}") | ||
logging.info("Downloading %s", source_url) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
proper way to use a logger... formatting is done in the logger only if that log level is active
with open(filepath, "w") as f: | ||
with open(filepath, "w", encoding="utf-8") as f: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this is a new pylint thing. whenever you open a file for reading/writing specify its encoding.
@@ -49,11 +67,10 @@ class ClusterTokenType(Enum): | |||
NONE = "" | |||
|
|||
|
|||
class TokenManager: | |||
class TokenManager(Protocol): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a Protocol isn't a base class, it's a type-definition for duck-typed classes.
tokenizer = self.token_strategies.get(token_strategy) | ||
assert tokenizer, f"Invalid token_strategy: {token_strategy}" # nosec | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pylint was fussing about too many local variables. This is a bit of code golf to slim down the variables
@@ -45,21 +45,21 @@ def test_event_timer_properties(harness): | |||
|
|||
|
|||
@mock.patch("reschedule._execute_command") | |||
def test_event_timer_is_active(exec, harness): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exec
is a keyword in python -- thou shalt not use it for your variables
@@ -45,7 +45,7 @@ plugins = "pydantic.mypy" | |||
[tool.pylint] | |||
# Ignore too-few-public-methods due to pydantic models | |||
# Ignore no-self-argument due to pydantic validators | |||
disable = "wrong-import-order,redefined-outer-name,too-many-instance-attributes,too-few-public-methods,no-self-argument,fixme,parse-error" | |||
disable = "wrong-import-order,redefined-outer-name,too-many-instance-attributes,too-few-public-methods,no-self-argument,fixme,protected-access" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i really want to test some protected member functions of the snap class. So-- lets ignore those errors
6036c6d
to
46534d0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks
Overview
With more linting powers comes more linting issues
Details